<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: IRTTest</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">IRTTest</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/test/irt_test_rb.html">
                test/irt_test.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Test::Unit::TestCase
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">
    <div id="diagram">
      <map id="map" name="map">
  <area shape="rect" coords="39,101,111,149"      href="IRTTest.html" alt="IRTTest" />
  <area shape="rect" coords="5,5,144,53"      href="Test/Unit/TestCase.html" alt="Test::Unit::TestCase" />
</map>
<img src="../dot/f_18.png" usemap="#map" border="0" alt="dot/f_18.png">
    </div>

    <div id="description">
      <ul>
<li>irt_test.rb

</li>
<li>Copyright (C) 2010 Embian Inc.

<p>
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
</p>
<p>
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
</p>
<p>
You should have received a copy of the GNU General Public License along
with This program. If not, see &lt;<a
href="http://www.gnu.org/licenses">www.gnu.org/licenses</a>/&gt;.
</p>
</li>
</ul>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000004">setup</a>&nbsp;&nbsp;
      <a href="#M000005">teardown</a>&nbsp;&nbsp;
      <a href="#M000006">test_11</a>&nbsp;&nbsp;
      <a href="#M000009">test_estimates_examinee_score</a>&nbsp;&nbsp;
      <a href="#M000008">test_estimates_examinee_theta</a>&nbsp;&nbsp;
      <a href="#M000007">test_estimates_item_params</a>&nbsp;&nbsp;
      <a href="#M000010">test_load_estimated_item_params</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000004" class="method-detail">
        <a name="M000004"></a>

        <div class="method-heading">
          <a href="#M000004" class="method-signature">
          <span class="method-name">setup</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000004-source">
<pre>
    <span class="ruby-comment cmt"># File test/irt_test.rb, line 26</span>
26:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span>
27:     <span class="ruby-ivar">@examinees</span> = []
28:     <span class="ruby-ivar">@items</span> = []
29: 
30:     <span class="ruby-ivar">@expected_item_params</span> = [
31:       {<span class="ruby-identifier">:irt_a=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">1.0961847175</span>, <span class="ruby-identifier">:irt_b=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">-0</span><span class="ruby-value">.9685120336</span>, <span class="ruby-identifier">:irt_c=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">0</span><span class="ruby-value">.2210026076</span>},
32:       {<span class="ruby-identifier">:irt_a=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">0</span><span class="ruby-value">.5649699880</span>, <span class="ruby-identifier">:irt_b=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">-0</span><span class="ruby-value">.5473557856</span>, <span class="ruby-identifier">:irt_c=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">0</span><span class="ruby-value">.2289350984</span>},
33:       {<span class="ruby-identifier">:irt_a=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">1.0276089825</span>, <span class="ruby-identifier">:irt_b=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">0</span><span class="ruby-value">.1696606494</span>,  <span class="ruby-identifier">:irt_c=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">0</span><span class="ruby-value">.2209021813</span>},
34:       {<span class="ruby-identifier">:irt_a=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">0</span><span class="ruby-value">.9774353728</span>, <span class="ruby-identifier">:irt_b=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">-0</span><span class="ruby-value">.3342768143</span>, <span class="ruby-identifier">:irt_c=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">0</span><span class="ruby-value">.2232607784</span>},
35:       {<span class="ruby-identifier">:irt_a=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">1.1390936486</span>, <span class="ruby-identifier">:irt_b=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">-0</span><span class="ruby-value">.7270930940</span>, <span class="ruby-identifier">:irt_c=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">0</span><span class="ruby-value">.2174390876</span>}
36:     ]
37: 
38:     <span class="ruby-ivar">@expected_thetas</span> = 
39:     [
40:       <span class="ruby-value">0</span><span class="ruby-value">.8705128329</span>,
41:       <span class="ruby-value">-0</span><span class="ruby-value">.3510661255</span>,
42:       <span class="ruby-value">0</span><span class="ruby-value">.4103015636</span>,
43:       <span class="ruby-value">-0</span><span class="ruby-value">.7703148359</span>,
44:       <span class="ruby-value">0</span><span class="ruby-value">.8705128329</span>,
45:       <span class="ruby-value">-0</span><span class="ruby-value">.1612686685</span>,
46:       <span class="ruby-value">-0</span><span class="ruby-value">.5311113233</span>,
47:       <span class="ruby-value">0</span><span class="ruby-value">.8705128329</span>,
48:       <span class="ruby-value">0</span><span class="ruby-value">.3801369220</span>,
49:       <span class="ruby-value">-1.5823751989</span>,
50:     ]
51: 
52:     <span class="ruby-ivar">@expected_score</span> = 
53:     [
54:       <span class="ruby-value">4.5148733044</span>,
55:       <span class="ruby-value">3.2594170786</span>,
56:       <span class="ruby-value">4.1633914194</span>,
57:       <span class="ruby-value">2.6713665208</span>,
58:       <span class="ruby-value">4.5148733044</span>,
59:       <span class="ruby-value">3.5154202106</span>,
60:       <span class="ruby-value">3.0071541409</span>,
61:       <span class="ruby-value">4.5148733044</span>,
62:       <span class="ruby-value">4.1348981314</span>,
63:       <span class="ruby-value">1.7550360960</span>
64:     ]
65: 
66:     <span class="ruby-identifier">answers</span> = [<span class="ruby-value str">'A'</span>, <span class="ruby-value str">'B'</span>, <span class="ruby-value str">'C'</span>, <span class="ruby-value str">'D'</span>]
67:     <span class="ruby-ivar">@responses</span> = [
68:       [<span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>],
69:       [<span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">1</span>],
70:       [<span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>],
71:       [<span class="ruby-value">0</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>],
72:       [<span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>],
73:       [<span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>],
74:       [<span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">-1</span>],
75:       [<span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>],
76:       [<span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">-1</span>, <span class="ruby-value">-1</span>, <span class="ruby-value">-1</span>],
77:       [<span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>]
78:     ]
79:     
80:     <span class="ruby-ivar">@items</span> = []
81:     <span class="ruby-value">5</span>.<span class="ruby-identifier">times</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">no</span><span class="ruby-operator">|</span>
82:       <span class="ruby-identifier">item</span> = <span class="ruby-constant">IRTItem</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;id##{no}&quot;</span>)
83:       <span class="ruby-identifier">item</span>.<span class="ruby-identifier">answer</span> = <span class="ruby-identifier">answers</span>[<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">answers</span>.<span class="ruby-identifier">size</span>)]
84:       <span class="ruby-ivar">@items</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">item</span>
85:     <span class="ruby-keyword kw">end</span>
86: 
87:     <span class="ruby-ivar">@examinees</span> = []
88:     <span class="ruby-value">10</span>.<span class="ruby-identifier">times</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">no</span><span class="ruby-operator">|</span>
89:       <span class="ruby-ivar">@examinees</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">IRTExaminee</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;id##{no}&quot;</span>, <span class="ruby-ivar">@responses</span>[<span class="ruby-identifier">no</span>], <span class="ruby-node">&quot;00000-0000#{no}&quot;</span>)
90:     <span class="ruby-keyword kw">end</span>
91: 
92:     <span class="ruby-ivar">@exam</span> = <span class="ruby-constant">IRTExam</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@examinees</span>, <span class="ruby-ivar">@items</span>)
93:     <span class="ruby-ivar">@irt</span> = <span class="ruby-constant">IRT</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@exam</span>, <span class="ruby-constant">IRTModel</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">IRTModel</span><span class="ruby-operator">::</span><span class="ruby-constant">DICHOTOMOUS_3PL</span>))
94:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000005" class="method-detail">
        <a name="M000005"></a>

        <div class="method-heading">
          <a href="#M000005" class="method-signature">
          <span class="method-name">teardown</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000005-source">
<pre>
    <span class="ruby-comment cmt"># File test/irt_test.rb, line 96</span>
96:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">teardown</span>
97:     <span class="ruby-ivar">@irt</span>.<span class="ruby-identifier">release</span>
98:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000006" class="method-detail">
        <a name="M000006"></a>

        <div class="method-heading">
          <a href="#M000006" class="method-signature">
          <span class="method-name">test_11</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000006-source">
<pre>
     <span class="ruby-comment cmt"># File test/irt_test.rb, line 100</span>
100:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_11</span>
101:     <span class="ruby-ivar">@irt</span>.<span class="ruby-identifier">estimates_item_params</span>
102:     <span class="ruby-ivar">@irt</span>.<span class="ruby-identifier">estimates_examinee_theta</span>
103:     <span class="ruby-ivar">@irt</span>.<span class="ruby-identifier">estimates_examinee_score</span>(<span class="ruby-keyword kw">true</span>)
104:     
105:     <span class="ruby-comment cmt">#----------------------------------</span>
106:     
107:     <span class="ruby-identifier">estimated_items</span> = []
108:     <span class="ruby-value">5</span>.<span class="ruby-identifier">times</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">no</span><span class="ruby-operator">|</span>
109:       <span class="ruby-identifier">item</span> = <span class="ruby-constant">IRTItem</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;id##{no}&quot;</span>)
110:       <span class="ruby-identifier">item</span>.<span class="ruby-identifier">answer</span> = <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">no</span>].<span class="ruby-identifier">answer</span>
111:   
112:       <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_a</span> = <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">no</span>].<span class="ruby-identifier">irt_a</span>
113:       <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_b</span> = <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">no</span>].<span class="ruby-identifier">irt_b</span>
114:       <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_c</span> = <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">no</span>].<span class="ruby-identifier">irt_c</span>
115:   
116:       <span class="ruby-identifier">estimated_items</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">item</span>
117:     <span class="ruby-keyword kw">end</span>
118:     
119:     <span class="ruby-identifier">new_examinees</span> = []
120:     <span class="ruby-value">1</span>.<span class="ruby-identifier">times</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">no</span><span class="ruby-operator">|</span>
121:       <span class="ruby-identifier">new_examinees</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">IRTExaminee</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;id##{no}&quot;</span>, <span class="ruby-ivar">@responses</span>[<span class="ruby-identifier">no</span>], <span class="ruby-node">&quot;00000-0000#{no}&quot;</span>)
122:     <span class="ruby-keyword kw">end</span>
123:     
124:     <span class="ruby-identifier">test</span> = <span class="ruby-constant">IRTExam</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">new_examinees</span>, <span class="ruby-identifier">estimated_items</span>)
125:     <span class="ruby-identifier">irt</span> = <span class="ruby-constant">IRT</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">test</span>, <span class="ruby-ivar">@model_3PL</span>)
126:     <span class="ruby-identifier">irt</span>.<span class="ruby-identifier">load_estimated_item_params</span>
127:     
128:     <span class="ruby-identifier">estimated_items</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
129:       <span class="ruby-identifier">params</span> = <span class="ruby-ivar">@expected_item_params</span>[<span class="ruby-identifier">i</span>]
130:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:irt_a</span>], (<span class="ruby-value str">&quot;%.10f&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_a</span>).<span class="ruby-identifier">to_f</span>)
131:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:irt_b</span>], (<span class="ruby-value str">&quot;%.10f&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_b</span>).<span class="ruby-identifier">to_f</span>)
132:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:irt_c</span>], (<span class="ruby-value str">&quot;%.10f&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_c</span>).<span class="ruby-identifier">to_f</span>)
133:     <span class="ruby-keyword kw">end</span>
134:   
135:     <span class="ruby-identifier">irt</span>.<span class="ruby-identifier">estimates_examinee_theta</span>
136:   
137:     <span class="ruby-identifier">new_examinees</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">examinee</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
138:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-ivar">@expected_thetas</span>[<span class="ruby-identifier">i</span>], (<span class="ruby-value str">&quot;%.10f&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">examinee</span>.<span class="ruby-identifier">theta</span>).<span class="ruby-identifier">to_f</span>)
139:     <span class="ruby-keyword kw">end</span>
140:     
141:     <span class="ruby-identifier">irt</span>.<span class="ruby-identifier">estimates_examinee_score</span>(<span class="ruby-keyword kw">true</span>)
142:     <span class="ruby-identifier">new_examinees</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">examinee</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
143:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-ivar">@expected_score</span>[<span class="ruby-identifier">i</span>], (<span class="ruby-value str">&quot;%.10f&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">examinee</span>.<span class="ruby-identifier">score</span>).<span class="ruby-identifier">to_f</span>)
144:       <span class="ruby-ivar">@items</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
145:         <span class="ruby-identifier">assert_not_nil</span>(<span class="ruby-identifier">examinee</span>.<span class="ruby-identifier">scores</span>[<span class="ruby-identifier">item</span>.<span class="ruby-identifier">no</span>])
146:       <span class="ruby-keyword kw">end</span>
147:     <span class="ruby-keyword kw">end</span>
148:     
149:     <span class="ruby-identifier">irt</span>.<span class="ruby-identifier">release</span>
150:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000009" class="method-detail">
        <a name="M000009"></a>

        <div class="method-heading">
          <a href="#M000009" class="method-signature">
          <span class="method-name">test_estimates_examinee_score</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000009-source">
<pre>
     <span class="ruby-comment cmt"># File test/irt_test.rb, line 181</span>
181:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_estimates_examinee_score</span>
182:     <span class="ruby-ivar">@irt</span>.<span class="ruby-identifier">estimates_item_params</span>
183:     <span class="ruby-ivar">@irt</span>.<span class="ruby-identifier">estimates_examinee_theta</span>
184:     <span class="ruby-ivar">@examinees</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">examinee</span><span class="ruby-operator">|</span>
185:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-value">0</span><span class="ruby-value">.0</span>, <span class="ruby-identifier">examinee</span>.<span class="ruby-identifier">score</span>)
186:       <span class="ruby-identifier">assert</span>(<span class="ruby-identifier">examinee</span>.<span class="ruby-identifier">scores</span>.<span class="ruby-identifier">empty?</span>)
187:     <span class="ruby-keyword kw">end</span>
188: 
189:     <span class="ruby-ivar">@irt</span>.<span class="ruby-identifier">estimates_examinee_score</span>(<span class="ruby-keyword kw">true</span>)
190: 
191:     <span class="ruby-ivar">@examinees</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">examinee</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
192:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-ivar">@expected_score</span>[<span class="ruby-identifier">i</span>], (<span class="ruby-value str">&quot;%.10f&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">examinee</span>.<span class="ruby-identifier">score</span>).<span class="ruby-identifier">to_f</span>)
193:       <span class="ruby-ivar">@items</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
194:         <span class="ruby-identifier">assert_not_nil</span>(<span class="ruby-identifier">examinee</span>.<span class="ruby-identifier">scores</span>[<span class="ruby-identifier">item</span>.<span class="ruby-identifier">no</span>])
195:       <span class="ruby-keyword kw">end</span>
196:     <span class="ruby-keyword kw">end</span>
197:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000008" class="method-detail">
        <a name="M000008"></a>

        <div class="method-heading">
          <a href="#M000008" class="method-signature">
          <span class="method-name">test_estimates_examinee_theta</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000008-source">
<pre>
     <span class="ruby-comment cmt"># File test/irt_test.rb, line 168</span>
168:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_estimates_examinee_theta</span>
169:     <span class="ruby-ivar">@irt</span>.<span class="ruby-identifier">estimates_item_params</span>
170:     <span class="ruby-ivar">@examinees</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">examinee</span><span class="ruby-operator">|</span>
171:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-value">0</span><span class="ruby-value">.0</span>, <span class="ruby-identifier">examinee</span>.<span class="ruby-identifier">theta</span>)
172:     <span class="ruby-keyword kw">end</span>
173: 
174:     <span class="ruby-ivar">@irt</span>.<span class="ruby-identifier">estimates_examinee_theta</span>
175: 
176:     <span class="ruby-ivar">@examinees</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">examinee</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
177:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-ivar">@expected_thetas</span>[<span class="ruby-identifier">i</span>], (<span class="ruby-value str">&quot;%.10f&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">examinee</span>.<span class="ruby-identifier">theta</span>).<span class="ruby-identifier">to_f</span>)
178:     <span class="ruby-keyword kw">end</span>
179:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000007" class="method-detail">
        <a name="M000007"></a>

        <div class="method-heading">
          <a href="#M000007" class="method-signature">
          <span class="method-name">test_estimates_item_params</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000007-source">
<pre>
     <span class="ruby-comment cmt"># File test/irt_test.rb, line 152</span>
152:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_estimates_item_params</span>
153:     <span class="ruby-ivar">@items</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
154:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-value">0</span><span class="ruby-value">.0</span>, <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_a</span>)
155:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-value">0</span><span class="ruby-value">.0</span>, <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_b</span>)
156:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-value">0</span><span class="ruby-value">.0</span>, <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_c</span>)
157:     <span class="ruby-keyword kw">end</span>
158:     <span class="ruby-ivar">@irt</span>.<span class="ruby-identifier">estimates_item_params</span>
159: 
160:     <span class="ruby-ivar">@items</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
161:       <span class="ruby-identifier">params</span> = <span class="ruby-ivar">@expected_item_params</span>[<span class="ruby-identifier">i</span>]
162:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:irt_a</span>], (<span class="ruby-value str">&quot;%.10f&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_a</span>).<span class="ruby-identifier">to_f</span>)
163:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:irt_b</span>], (<span class="ruby-value str">&quot;%.10f&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_b</span>).<span class="ruby-identifier">to_f</span>)
164:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:irt_c</span>], (<span class="ruby-value str">&quot;%.10f&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_c</span>).<span class="ruby-identifier">to_f</span>)
165:     <span class="ruby-keyword kw">end</span>
166:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000010" class="method-detail">
        <a name="M000010"></a>

        <div class="method-heading">
          <a href="#M000010" class="method-signature">
          <span class="method-name">test_load_estimated_item_params</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000010-source">
<pre>
     <span class="ruby-comment cmt"># File test/irt_test.rb, line 199</span>
199:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_load_estimated_item_params</span>
200:     <span class="ruby-ivar">@irt</span>.<span class="ruby-identifier">estimates_item_params</span>
201:     <span class="ruby-ivar">@irt</span>.<span class="ruby-identifier">estimates_examinee_theta</span>
202:     <span class="ruby-ivar">@irt</span>.<span class="ruby-identifier">estimates_examinee_score</span>(<span class="ruby-keyword kw">true</span>)
203:     
204:     <span class="ruby-comment cmt">#----------------------------------</span>
205:     
206:     <span class="ruby-identifier">estimated_items</span> = []
207:     <span class="ruby-value">5</span>.<span class="ruby-identifier">times</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">no</span><span class="ruby-operator">|</span>
208:       <span class="ruby-identifier">item</span> = <span class="ruby-constant">IRTItem</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;id##{no}&quot;</span>)
209:       <span class="ruby-identifier">item</span>.<span class="ruby-identifier">answer</span> = <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">no</span>].<span class="ruby-identifier">answer</span>
210:   
211:       <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_a</span> = <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">no</span>].<span class="ruby-identifier">irt_a</span>
212:       <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_b</span> = <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">no</span>].<span class="ruby-identifier">irt_b</span>
213:       <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_c</span> = <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">no</span>].<span class="ruby-identifier">irt_c</span>
214:   
215:       <span class="ruby-identifier">estimated_items</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">item</span>
216:     <span class="ruby-keyword kw">end</span>
217:     
218:     <span class="ruby-identifier">new_examinees</span> = []
219:     <span class="ruby-value">10</span>.<span class="ruby-identifier">times</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">no</span><span class="ruby-operator">|</span>
220:       <span class="ruby-identifier">new_examinees</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">IRTExaminee</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;id##{no}&quot;</span>, <span class="ruby-ivar">@responses</span>[<span class="ruby-identifier">no</span>], <span class="ruby-node">&quot;00000-0000#{no}&quot;</span>)
221:     <span class="ruby-keyword kw">end</span>
222:     
223:     <span class="ruby-identifier">test</span> = <span class="ruby-constant">IRTExam</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">new_examinees</span>, <span class="ruby-identifier">estimated_items</span>)
224:     <span class="ruby-identifier">irt</span> = <span class="ruby-constant">IRT</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">test</span>, <span class="ruby-ivar">@model_3PL</span>)
225:     <span class="ruby-identifier">irt</span>.<span class="ruby-identifier">load_estimated_item_params</span>
226:     
227:     <span class="ruby-identifier">estimated_items</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
228:       <span class="ruby-identifier">params</span> = <span class="ruby-ivar">@expected_item_params</span>[<span class="ruby-identifier">i</span>]
229:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:irt_a</span>], (<span class="ruby-value str">&quot;%.10f&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_a</span>).<span class="ruby-identifier">to_f</span>)
230:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:irt_b</span>], (<span class="ruby-value str">&quot;%.10f&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_b</span>).<span class="ruby-identifier">to_f</span>)
231:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:irt_c</span>], (<span class="ruby-value str">&quot;%.10f&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">irt_c</span>).<span class="ruby-identifier">to_f</span>)
232:     <span class="ruby-keyword kw">end</span>
233:   
234:     <span class="ruby-identifier">irt</span>.<span class="ruby-identifier">estimates_examinee_theta</span>
235:   
236:     <span class="ruby-identifier">new_examinees</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">examinee</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
237:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-ivar">@expected_thetas</span>[<span class="ruby-identifier">i</span>], (<span class="ruby-value str">&quot;%.10f&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">examinee</span>.<span class="ruby-identifier">theta</span>).<span class="ruby-identifier">to_f</span>)
238:     <span class="ruby-keyword kw">end</span>
239:     
240:     <span class="ruby-identifier">irt</span>.<span class="ruby-identifier">estimates_examinee_score</span>(<span class="ruby-keyword kw">true</span>)
241:     <span class="ruby-identifier">new_examinees</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">examinee</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
242:       <span class="ruby-identifier">assert_equal</span>(<span class="ruby-ivar">@expected_score</span>[<span class="ruby-identifier">i</span>], (<span class="ruby-value str">&quot;%.10f&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">examinee</span>.<span class="ruby-identifier">score</span>).<span class="ruby-identifier">to_f</span>)
243:       <span class="ruby-ivar">@items</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
244:         <span class="ruby-identifier">assert_not_nil</span>(<span class="ruby-identifier">examinee</span>.<span class="ruby-identifier">scores</span>[<span class="ruby-identifier">item</span>.<span class="ruby-identifier">no</span>])
245:       <span class="ruby-keyword kw">end</span>
246:     <span class="ruby-keyword kw">end</span>
247:     
248:     <span class="ruby-identifier">irt</span>.<span class="ruby-identifier">release</span>
249:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>